package com.health.api.fallback;


import com.health.api.client.UserClient;
import com.health.api.model.hospital.GetHospitalInfoRequest;
import com.health.api.model.hospital.HospitalVO;
import com.health.common.model.user.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;


/**
 * @author zhexueqi
 * @ClassName ItemClientFallback
 * @since 2024/5/14    21:35
 */
@Slf4j
public class UserClientFallback implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable cause) {
        return new UserClient() {
            @Override
            public LoginUser getUserInfoByUserAccountAndUserPassword(String userAccount, String userPassword, Integer userRole) {
                log.error("调用item-service服务的queryItemByIds失败", cause);
                return null;
            }

            @Override
            public List<String> getRoleList(Long loginId) {
                return List.of();
            }

            @Override
            public HospitalVO getHospitalInfo(GetHospitalInfoRequest getHospitalInfoRequest) {
                log.error("调用hospital-service服务的getHospitalInfo失败", cause);
                return null;
            }
        };
    }
}
